package com.shut.vehicle.exception;

import com.shut.vehicle.controller.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.ResponseBody;


@Slf4j
@CrossOrigin
@ResponseBody
@ControllerAdvice
public class ExceptionHandler {


    @org.springframework.web.bind.annotation.ExceptionHandler(ServiceException.class)
    public Result serviceException(ServiceException e) {
        log.error(e.getMessage());
        return Result.fail(e.getMessage());
    }


}
